<div class="row-content am-cf">
	<div class="row">
		<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
			<div class="widget am-cf">
				<div class="widget-head am-cf">
					<div class="widget-title am-fl">新增字典</div>
					<div class="widget-function am-fr">
						<a href="javascript:;" class="am-icon-cog"></a>
					</div>
				</div>
				<div class="widget-body am-fr">
					<form class="am-form tpl-form-line-form" id="dataForm" method="post">
						<div class="am-form-group">
							<label for="name" class="am-u-sm-2 am-form-label">字典标识</label>
							<div class="am-u-sm-10">
								<input type="hidden" id="pid" name="pid" th:value="${pid}"/> 
								<input type="text" th:if="${#strings.isEmpty(code)}"  class="tpl-form-input" placeholder="请输入字典标识" id="code" name="code" /> 
								<input type="text" th:if="${!#strings.isEmpty(code)}"  class="tpl-form-input"  readonly="readonly" id="code" name="code" th:value="${code}"/> 
								
							</div>
						</div>
						<div class="am-form-group" id="urlDiv">
							<label for="sourceUrl" class="am-u-sm-2 am-form-label">名称</label>
							<div class="am-u-sm-10">
								<input type="text"  class="tpl-form-input" placeholder="请输入名称" id="name" name="name" /> 
							</div>
						</div>
						<div class="am-form-group">
							<label for="sourceKey" class="am-u-sm-2 am-form-label">序号</label>
							<div class="am-u-sm-10">
								<input type="text" th:if="${pid ==0}" class="tpl-form-input" readonly="readonly" value="0" id="num" name="num" /> 
								<input type="text" th:if="${pid !=0}" class="tpl-form-input" placeholder="请输入序号" id="num" name="num" /> 
							</div>
						</div>
						<div class="am-form-group">
							<label for="description" class="am-u-sm-2 am-form-label">备注</label>
							<div class="am-u-sm-10">
								<input type="text"  class="tpl-form-input" placeholder="请输入备注" id="tips" name="tips" /> 
							</div>
						</div>

						<div class="am-form-group">
							<div class="am-u-sm-10 am-u-sm-push-2">
								
								<button type="button" onclick="javascript:$('#dataForm').submit();"
									class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
										<button type="button" onclick="loadPage('dict/listUI')"
									class="am-btn am-btn-success tpl-btn-bg-color-success ">返回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

	</div>
	<script th:inline="javascript">
	<![CDATA[
	validateForm();
	function validateForm(){    
	    $('#dataForm').validate({
	        errorElement : 'span',
	        errorClass : 'am-icon-times',
	        focusInvalid : true,
	        onkeyup:false,
	        ignore : "",
	        rules : {
	        	code:{
	        		required : true
	        	},
	            name : {
	                required : true
	            },
	            num : {
	                required : true
	            }
	        },
	        messages : {
	        	code : {
	                required : "请填写唯一标识"
	            },
	        	name : {
	                required : "请填写名称"
	            },
	            num : {
	                required : "请填写序号"
	            }
	        },
	        submitHandler : function(form) {
	        	commit('dataForm', 'dict/save', 'dict/listUI');
	        }
	    });
	}
		]]>
	</script>